package com.hotelManagerSystem.mapper;

import com.hotelManagerSystem.model.Dish;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author treasy
 * @since 2021-12-22
 */
public interface DishMapper extends BaseMapper<Dish> {
    @Insert("insert `dish` (dish_name, dish_price, dish_description, dish_img)" +
            "(#{dishName}, #{dishPrice}, #{dishDescription}, #{dishImg}")
    int addOne(Dish dish);

    @Update("update `dish` set dish_name = #{dishName}, dishPrice = #{dishPrice}, " +
            "dish_description = #{dishDescription}, dish_img = #{dishImg}")
    int update(Dish dish);

    @Select("select * from `dish`")
    List<Dish> queryAll();

    @Select("select * from `dish` where dish_name like #{name}")
    List<Dish> queryByName(String name);
}
